
/*

DEPENDENCIES:
-------------
Gimme.Effects
ext.get_style_pos
-------------


IN THIS FILE:
-------------
ext.bounce
-------------

*/

Gimme.ext.bounce = function(from, to, duration, guid, callback)
{
	function getTop(elem)
	{
		return Gimme(elem).get_style_pos().y;
	}
	
	if (from === null)
	{
		from = getTop;
	}
	
	var sb = Gimme.Effects.Storyboard.create
	(
		// items to animate
		this,
		
		//from
		{ top: from },
		
		// to
		{ top: to },
		
		// animate function
		function(elem, props)
		{
			elem.style.top = Math.ceil(props.top) + 'px';
		},
		
		// duration
		duration,
		
		// guid
		guid,
		
		// callback
		callback,
		
		// easing
		Gimme.Effects.Easing.Bounce.ease_out
	);
	
	sb.begin();			
	return this;
};